package com.foreknow.Collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo04 {
    public static void main(String[] args) {
        //创建集合对象
        Collection c1 = new ArrayList();
        //向集合中存储对象
        String s1 = new String("abc");
        String s2 = new String("def");
        c1.add(s1);
        c1.add(s2);
        //集合中元素的个数
        System.out.println("元素的个数是"+ c1.size());
        //新建的对象String
        String x = new String("abc");
        System.out.println(c1.contains(x));//应该是true

    }
}
